Add ISO/IEC 8211 writer/encoder and builders (#12)#13
Merged
Conversation
Implement a first-class writer/encoder for EncDotNet.Iso8211 as the symmetric inverse of the existing reader, enabling downstream serialization of documents back to .000 cells. Round-trip surface: - Iso8211DocumentWriter: Write(doc)->byte[], Write(Stream), WriteAsync, WriteToFile/WriteToFileAsync. Byte-identical for canonical sources. - Iso8211RecordWriter: encodes one record (leader/directory/field area). - Iso8211WriterOptions: lexical level, encoding, entry-map auto-sizing. Construction-from-scratch: - Iso8211SubfieldEncoder: encodes every Iso8211SubfieldFormatType (inverse of the reader's ConvertValue). - Iso8211FieldBuilder / Iso8211RecordBuilder / Iso8211DocumentBuilder: fluent builders mirroring reader subfield sequencing and UT placement. - Iso8211DataDescriptiveRecordWriter: encodes DDR field definitions. Tests: byte-identical round-trips, builder Write->Read, per-format encode/decode, DDR encode->read, stream/file overloads, and an opt-in corpus round-trip (skips without ISO8211_CORPUS_DIR). No breaking changes to reader APIs; XML docs on all new public types. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: ead2ac19-7b31-431f-84c2-edb303f789fe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a first-class ISO/IEC 8211 writer/encoder — the symmetric inverse of the existing reader — so datasets can be produced, not just parsed. Closes #12.
What's new (8 source files under
src/EncDotNet.Iso8211, no breaking changes to reader APIs)Iso8211DocumentWriter—Write(doc) → byte[],Write(Stream)/WriteAsync,WriteToFile/WriteToFileAsync. Round-trippable and byte-identical for canonically-encoded sources (recomputes only directory / base address / record length).Iso8211RecordWriter— encodes one record (leader + directory + field area).Iso8211SubfieldEncoder— inverse of the reader'sConvertValue; handles everyIso8211SubfieldFormatType(fixed/variable char, ASCII int/real, signed/unsigned/floating binary little-endian at declared widths, bit strings).Iso8211FieldBuilder/Iso8211RecordBuilder/Iso8211DocumentBuilder— fluent construction from scratch, mirroring reader subfield sequencing, repeating-group wrap, and UT/FT placement.Iso8211DataDescriptiveRecordWriter— DDR encoder (field controls + descriptors + format controls, canonical 2-UT layout).Iso8211WriterOptions— lexical level, encoding (ASCII default), directory entry auto-sizing.Tests
Byte-identical round-trips, builder Write→Read model equivalence, per-format encode/decode, DDR encode→read, stream/file overloads, plus an opt-in corpus round-trip that self-skips unless
ISO8211_CORPUS_DIRis set. Full suite: 469 passed, 0 failed. Builds clean fornet8.0;net10.0. XML docs on all new public types; README updated with a writing/builders section.Motivation
Unblocks downstream
philliphoff/EncDotNet.S100, which needs to serialize anS101Documentback to a.000cell for ans100 s57 convertcommand.